package com.zmn.plat.admin.controller.plat.contract.model;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zmn.common.constant.GlobalConsts;
import com.zmn.common.dto2.ResponseDTO;
import com.zmn.plat.model.entity.plat.contract.model.PlatContractModel;

/**
 * 平台服务合同模式
 *
 * @author linfeng
 *
 * @since 2020/09/18 18:23
 */
@RestController
@RequestMapping("/plat/contract/model/")
public class PlatContractModelModifyController extends PlatContractModelBaseController {

    /**
     * 新增/修改平台合同模式
     * 
     * @author linfeng
     * @param platContractModels
     * @since 2020/09/18 18:23
     */
    @RequestMapping(value = "addEdit")
    public ResponseDTO addEdit(HttpServletRequest request, @RequestBody List<PlatContractModel> platContractModels) {
        try {
            platContractModelBService.modifyPlatContractModel(platContractModels, getMcStaff());
        } catch (Exception e) {
            logger.error("平台合同模式保存失败:", e);
            return ResponseDTO.fail("平台合同模式保存失败");
        }

        return ResponseDTO.success(GlobalConsts.YES, "保存成功");
    }

}
